package com.ruoyi.common.core.enums;

import java.util.Objects;

public enum YesOrNoEnum {
    NO(0, "否"),
    YES(1, "是");
    private final Integer code;
    private final String name;

    YesOrNoEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static boolean isValidCode(Integer code) {
        for (YesOrNoEnum e : YesOrNoEnum.values()) {
            if (Objects.equals(e.getCode(), code)) {
                return true;
            }
        }

        return false;
    }

    public Integer getCode() {
        return code;
    }
}
